package org.agent.common;

import java.util.ArrayList;
import java.util.List;

import org.agent.pojo.SystemConfig;
import org.springframework.web.context.WebApplicationContext;

public class Constants {
	public static WebApplicationContext webApplicationContext;
	
	public static final String SESSION_USER="userSession";//保存session用户
	
	/**********系统配置项常量******/
	public static List<SystemConfig> systemConfigList;//所有配置项，从数据库拿
	//财务类型1
	public static List<SystemConfig> accountConfigList=new ArrayList<SystemConfig>();
	//服务类型2
	public static List<SystemConfig> serviceConfigList=new ArrayList<SystemConfig>();
	//服务年限3
	public static SystemConfig maxSerciceYearsConfig;
	//APP地址4
	public static SystemConfig appMakeUrlConfig;
	//客户类型5
	public static List<SystemConfig> customTypeConfigList=new ArrayList<SystemConfig>();
	//证件类型6
	public static List<SystemConfig> cardTypeConfigList=new ArrayList<SystemConfig>();
	//优惠类型7
	public static List<SystemConfig> sellConfigList=new ArrayList<SystemConfig>();
	
	//遍历所以配置项，并按照不同配置类型归类
	public static void configSystemDate(){
		//防止重复添加
		accountConfigList.clear();
		serviceConfigList.clear();
		customTypeConfigList.clear();
		cardTypeConfigList.clear();
		sellConfigList.clear();
		//遍历所以配置项，并按照不同配置类型归类
		for(SystemConfig config:systemConfigList){
			switch (config.getConfigType()) {
			case 1:
				accountConfigList.add(config);
				break;
			case 2:
				serviceConfigList.add(config);
				break;
			case 3:
				maxSerciceYearsConfig = config;
				break;
			case 4:
				appMakeUrlConfig = config;
				break;
			case 5:
				customTypeConfigList.add(config);
				break;
			case 6:
				cardTypeConfigList.add(config);
				break;
			case 7:
				sellConfigList.add(config);
				break;
			//default:
			//	break;
			}
			
			
		}
		
	}
	
	
}
